package example_05;

import java.util.Arrays;
import java.util.Scanner;

public class method_02 {
    /*生成0-9之间的随机数，根据用户要求的数量生成*/
    public static void main(String[] args) {
        int n;
        System.out.println("请输入生成数量：");
        Scanner input = new Scanner(System.in);
        n = input.nextInt();
        System.out.println(shengcheng(n));
        System.out.println(Arrays.toString(shengcheng1(n)));
    }

    public static String shengcheng(int n) {//返回值类型为String的方法
        String x = "";
        for (int i = 0; i < n; i++) {
            x += (int) (Math.random() * 10);
        }
        return x;
    }

    public static int[] shengcheng1(int n) {//返回值类型为数组的方法
        int[] x = new int[n];
        for (int i = 0; i < n; i++) {
            x[i] = (int) (Math.random() * 10);
        }
        return x;
    }
}
